package SourceCode;

import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author 曹见朋
 * @create 2024-06-30-16:25
 */
public class ThreadPool {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newFixedThreadPool(3);
        CompletableFuture<Void> com = CompletableFuture.runAsync(new Runnable() {
            @Override
            public void run() {
                System.out.println("我是一个任务");
                System.out.println(Thread.currentThread().getName());
                try {
                    TimeUnit.SECONDS.sleep(5);
                } catch (InterruptedException e) {


                }
            }
        });
        // com.whenComplete()
        System.out.println();
        AtomicInteger atomicInteger = new AtomicInteger(10);


    }
}
